{extend name="common/adminBase" /}
{block name="body"}
<link rel="stylesheet" type="text/css" href="/static/xadmin/css/formSelects-v4.css"/>
<style>
    .layui-textarea{
        height:150px !important;
        width:900px !important;
    }
    .layui-form-label{
        width:120px !important;
    }
    .xm-select,.xm-select--suffix{
        width:300px !important;
    }
    #div1,#div2,#div3,#div4,#div5,#div6{
        padding-bottom: 10px;padding-top:10px;
    }
    legend{
        color:#156eca;
    }
</style>
<body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form" onsubmit='return false' id="myform">
                    <div id="div1">
                    <!---------------------------------第一申请人----------------------------------->
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                      <legend>第一申请人</legend>
                    </fieldset>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                                <span class="x-red">*</span>申请人姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" id="L_username" name="name" value="{$admin.name}" required="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                                <span class="x-red">*</span>性别</label>
                            <div class="layui-input-inline">
                                <select name="sex">
                                    <option value="">---请选择---</option>
                                    <option value="1" {if $admin.sex=='男'}selected=''{/if}>男</option>
                                    <option value="0" {if $admin.sex=='女'}selected=''{/if}>女</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>出生年月</label>
                            <div class="layui-input-inline">
                                <input type="text" id="date" name="birthday" required="" value="{$admin.birthday}" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>职务/职称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="zhiwu" required="" value="{$admin.professiona}" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                                <span class="x-red">*</span>所在部门</label>
                            <div class="layui-input-inline">
                                <input type="text" name="bumen" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>是否专职教师</label>
                            <div class="layui-input-inline">
                                <select name="if_teacher">
                                    <option value=''>---请选择---</option>
                                    <option value='1' >是</option>
                                    <option value='0'>否</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>最终学历</label>
                            <div class="layui-input-inline">
                                <input type="text" name="xueli" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                                <span class="x-red">*</span>最后学位</label>
                            <div class="layui-input-inline">
                                <input type="text"  name="xuewei" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>外语语种及水平</label>
                            <div class="layui-input-inline">
                                <input type="text"  name="waiyu" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>专业领域</label>
                            <div class="layui-input-inline">
                                <input type="text"  name="lingyu" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                                <span class="x-red">*</span>手机号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="phone" required="" value="{$admin.phone}" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                                <span class="x-red">*</span>是否添加第二申请人</label>
                            <div class="layui-input-inline">
                                <input type="checkbox" name="close" {if $if_two==1}checked=""{/if} lay-skin="switch" lay-filter="if_two" lay-text="是|否">
                                <input type="hidden" name="if_two" id="two" value="{$if_two}" />
                            </div>
                        </div>
                    </div>
                    <!---------------------------------第二申请人----------------------------------->
                    <div id="if_two">
                    
                    </div>
                    </div>
                    <div id="div2">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                      <legend>申请者近五年承担或参加人文社科研究项目情况以及完成情况 <button type="button" class="layui-btn" id="but1" onclick="add_class()">增加</button></legend>
                    </fieldset>
                    <table class="layui-table layui-form" id="html1">
                        <tr style="color:#156eca;">
                            <td>项目来源类别</td>
                            <td>课题名称</td>
                            <td>批准时间</td>
                            <td>是否完成</td>
                            <td>操作</td>
                        </tr>
                    </table>

                    <div class="layui-form-item layui-form-text" style="margin-top:15px;display:none;" id="textid1">
                        <label class="layui-form-label">项目经验说明</label>
                        <div class="layui-input-block">
                          <textarea placeholder="（注明刊物的年、期或出版社、出版日期，限900字）" id="textid11" class="layui-textarea" name="desc"></textarea>
                        </div>
                    </div>
                    </div>
                    <!--申请信息-->
                    <div id="div3">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                      <legend>课题信息</legend>
                    </fieldset>
                    
                    <div class="layui-form-item">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>课题名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>研究方向</label>
                            <div class="layui-input-inline">
                                <input type="text" name="fangxiang" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>研究类别</label>
                            <div class="layui-input-inline">
                                <!--<input type="text" name="leibie" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">-->
                                <select name="leibie">
                                    <option value="基础理论研究">基础理论研究</option>
                                    <option value="应用理论研究">应用理论研究</option>
                                    <option value="应用研究">应用研究</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>计划完成时间</label>
                            <div class="layui-input-inline">
                                <input type="text" name="finish_time" required="" value="" lay-verify="required" autocomplete="off" class="layui-input date">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>最终成果形式</label>
                            <div class="layui-input-inline">
                                <!--<input type="text" name="result" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">-->
                                <select name="result" xm-select="select2"  lay-verify="required"> 
                                    <option value="著作">著作</option>
                                    <option value="论文">论文</option>
                                    <option value="研究或咨询报告">研究或咨询报告</option>
                                    <option value="专利">专利</option>
                                    <option value="智库类">智库类</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>申报项目级别</label>
                            <div class="layui-input-inline">
                                <select name="if_inportant" lay-verify="required">
                                    <option value="重点课题">重点课题</option>
                                    <option value="一般课题">一般课题</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label for="L_username" class="layui-form-label">
                            <span class="x-red">*</span>经费来源</label>
                            <div class="layui-input-inline">
                                <!--<input type="text" name="laiyuan" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">-->
                                <select name="laiyuan" lay-verify="required">
                                    <option value="申请人自筹">申请人自筹</option>
                                    <option value="申请支持">申请支持</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    </div>
                    <div id="div4">
                    <div class="layui-form-item layui-form-text" style="margin-top:15px;">
                        <label class="layui-form-label">本课题研究现状及趋势</label>
                        <div class="layui-input-block">
                          <textarea placeholder="（限1600字）" lay-verify="required" class="layui-textarea" name="xiangzhuang"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item layui-form-text" style="margin-top:15px;">
                        <label class="layui-form-label">课题内容</label>
                        <div class="layui-input-block">
                          <textarea placeholder="（限1800字）" lay-verify="required" class="layui-textarea" name="neirong"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item layui-form-text" style="margin-top:15px;">
                        <label class="layui-form-label">课题的研究思路和方法，包括已进行的研究工作情况和进度计划、中期成果，</label>
                        <div class="layui-input-block">
                          <textarea placeholder=" (限1800字）" lay-verify="required" class="layui-textarea" name="silu"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item layui-form-text" style="margin-top:15px;">
                        <label class="layui-form-label">研究工作前期研究基础及资料准备情况</label>
                        <div class="layui-input-block">
                          <textarea placeholder="（限800字）" lay-verify="required" class="layui-textarea" name="jichu"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item layui-form-text" style="margin-top:15px;">
                        <label class="layui-form-label">研究成果的预计去向及使用范围</label>
                        <div class="layui-input-block">
                          <textarea placeholder="（限700字）" lay-verify="required" class="layui-textarea" name="chengguo"></textarea>
                        </div>
                    </div>
                    </div>
                    <!--经费概算-->
                    <div id="div5">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                      <legend>经费概算</legend>
                    </fieldset>          
                    
                    <table  class="layui-table layui-form">
                        <tr style="color:#156eca;">
                            <th>支出类别</th>
                            <th>合计(万元)</th>
                            <th>第一年</th>
                            <th>第二年</th>
                        </tr>
                        <tr>
                            <td>1.图书资料费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" readonly="" id="price1" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price1_1" onchange="hj(1)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price1_2" onchange="hj(1)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>2．数据采集费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price2" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price2_1" onchange="hj(2)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price2_2" onchange="hj(2)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>3．调研差旅费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price3" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price3_1" onchange="hj(3)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price3_2" onchange="hj(3)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>4．设备购置和使用费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price4" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price4_1" onchange="hj(4)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price4_2" onchange="hj(4)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>5．会议费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price5" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price5_1" onchange="hj(5)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price5_2" onchange="hj(5)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>6．咨询费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price6" readonly=""class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price6_1" onchange="hj(6)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price6_2" onchange="hj(6)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>7.劳务费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price7" readonly=""class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price7_1" onchange="hj(7)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price7_2" onchange="hj(7)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>8．印刷费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price8" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price8_1" onchange="hj(8)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price8_2" onchange="hj(8)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>9．管理费</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price9" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price9_1" onchange="hj(9)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price9_2" onchange="hj(9)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>10．其他</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="price10" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="price10_1" onchange="hj(10)" class="layui-input dy10" style="border:none;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="price10_2" onchange="hj(10)" class="layui-input dy10" style="border:none;" />
                            </td>
                        </tr>
                        <tr>
                            <td>10．合计</td>
                            <td>
                                <input name="price[]" lay-verify="required" value="0" id="zong1" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year1[]" lay-verify="required" value="0" id="zong2" readonly="" class="layui-input" style="border:none;color:#666;" />
                            </td>
                            <td>
                                <input name="year2[]" lay-verify="required" value="0" id="zong3" readonly="" class="layui-input" style="border:none;color:#666;"/>
                            </td>
                        </tr>
                    </table>
                    </div>
                    <!--需要购置的一起和设备-->
                    <div id="div6">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                      <legend>仪器和设备  <button type="button" class="layui-btn" onclick="add_yq()" id="but3">增加</button></legend>
                    </fieldset>
                    <table  class="layui-table layui-form" id="add_yq">
                        <tr style="color:#156eca;">
                            <th>名称</th>
                            <th>数量</th>
                            <th>金额(万元)</th>
                            <th>年度</th>
                            <th>操作</th>
                        </tr>

                    </table>
                    </div>
                    <div id="div7">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                      <legend>课题组其他成员情况 <button type="button" class="layui-btn" onclick="add_member()" id="but_2">增加</button></legend>
                    </fieldset>
                    <table class="layui-table layui-form" id="html2">
                        <tr style="color:#156eca;">
                            <td>姓名</td>
                            <td>职业</td>
                            <td>年龄</td>
                            <td>专业</td>
                            <td>分工情况</td>
                            <td>工作单位</td>
                            <td>操作</td>
                        </tr>
                        
                    </table>
                    <div class="layui-form-item layui-form-text" style="margin-top:15px;display:none;" id="textid2">
                        <label class="layui-form-label">以上成员近三年来与本课题有关的主要研究成果，注明刊物的年、期或出版社、出版日期</label>
                        <div class="layui-input-block">
                          <textarea placeholder="以上成员近三年来与本课题有关的主要研究成果，注明刊物的年、期或出版社、出版日期（限
900字））" class="layui-textarea" name="sannianchengguo" id="textid21"></textarea>
                        </div>
                    </div>
                   </div>
                    <input type="hidden" name="cid" value="{$id}" />
                    <div style="position: fixed;top:0px;left:-15px;background:#fff;width:100%;">
                        <button class="layui-btn " style="margin-left:45px;" lay-filter="add" lay-submit="">提交</button>
                        <button class="layui-btn " onclick='tj()' >保存</button>
                        <button class="layui-btn " onclick="window.history.go(-1); ">取消</button>
                    </div>

                </form>
            </div>
        </div>
        <script>
        $("#div1").click(function(){
            
            $("#div1").css('background','none');
            $("#div2").css('background','none');
            $("#div3").css('background','none');
            $("#div4").css('background','none');
            $("#div5").css('background','none');
            $("#div6").css('background','none');
            $("#div1").css("background",'#e9edf0');
        });
        $("#div2").click(function(){
            $("#div1").css('background','none');
            $("#div2").css('background','none');
            $("#div3").css('background','none');
            $("#div4").css('background','none');
            $("#div5").css('background','none');
            $("#div6").css('background','none');
            // $("#div6").css('border','none');
            $("#div2").css("background",'#e9edf0');
            
        });
        $("#div3").click(function(){
            $("#div1").css('background','none');
            $("#div2").css('background','none');
            $("#div3").css('background','none');
            $("#div4").css('background','none');
            $("#div5").css('background','none');
            $("#div6").css('background','none');
            $("#div3").css("background",'#e9edf0');
        });
        $("#div4").click(function(){
            $("#div1").css('background','none');
            $("#div2").css('background','none');
            $("#div3").css('background','none');
            $("#div4").css('background','none');
            $("#div5").css('background','none');
            $("#div6").css('background','none');
            $("#div4").css("background",'#e9edf0');
        });
        $("#div5").click(function(){
            $("#div1").css('background','none');
            $("#div2").css('background','none');
            $("#div3").css('background','none');
            $("#div4").css('background','none');
            $("#div5").css('background','none');
            $("#div6").css('background','none');
            $("#div5").css("background",'#e9edf0');
        });
        $("#div6").click(function(){
            $("#div1").css('background','none');
            $("#div2").css('background','none');
            $("#div3").css('background','none');
            $("#div4").css('background','none');
            $("#div5").css('background','none');
            $("#div6").css('background','none');
            $("#div6").css("background",'#e9edf0');
        });
        $("#div7").click(function(){
            $("#div1").css('background','none');
            $("#div2").css('background','none');
            $("#div3").css('background','none');
            $("#div4").css('background','none');
            $("#div5").css('background','none');
            $("#div6").css('background','none');
            $("#div7").css("background",'#e9edf0');
        });
        $(".dy10").change(function(e){
            console.log(e);
                if(e.delegateTarget.value>10){
                    layer.msg('经费单位为万元，请核对后重新输入');
                    // $(this).val(0);
                }
                if(e.delegateTarget.value<0){
                    layer.msg('经费必须大于0');
                    $(this).val(0);
                }
            })
            function changenum(e){
                console.log($('#'+e).val());

                if($('#'+e).val()<0){
                    layer.msg('必须大于0');
                    $('#'+e).val(0);
                }
            }
            $("#add_yq").hide();
            
            var a = 0;
            function add_yq(){
                $("#add_yq").show();
                $("#but3").hide();
                var tr ='';
                 
                      tr = "<tr id=\"div3_"+a+"\">\n" +
                      "                            <td><input name=\"s_name["+a+"]\"  lay-verify=\"required\" class=\"layui-input \" style=\"border:none;\" /></td>\n" +
                      "                            <td><input name=\"s_num["+a+"]\" id='yq_"+a+"b'  lay-verify=\"required\" class=\"layui-input dy10\" onchange=\"changenum('yq_"+a+"b')\" style=\"border:none;\" /></td>\n" +
                      "                            <td><input name=\"s_price["+a+"]\" id='yq_"+a+"c'   lay-verify=\"required\"  class=\"layui-input dy10\" onchange=\"changenum('yq_"+a+"c')\" style=\"border:none;\" /></td>\n" +
                      "                            <td><input name=\"s_year["+a+"]\" id='yq_"+a+"d'   lay-verify=\"required\" class=\"layui-input dy10\"  style=\"border:none;\" /></td>\n" +
                      "                            <td><a href=\"javascript:void(0);\"  onclick=\"add_yq()\">增加</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:void(0);\" onclick=\"lot_div3("+a+")\">删除</a>\n" +
                      "                        </tr>";
                   
                  
                 a++;
                 $("#add_yq").append(tr);
                
            }
            function lot_div3(num){
                // var num
                $("#div3_"+num).remove();
                // console.log(a);
                
                a--;
                if(a==0){
                    $("#add_yq").hide();
                    $("#but3").show();
                }
            }
            function hj(id){
                var p1=$('#price'+id+'_1').val();
                var p2=$('#price'+id+'_2').val();
                var hj = (p1*1+p2*1).toFixed(2);
                var zong1 = 0;
                var zong2 = 0; 
                var zong3 = 0;
                if(p1>10){
                    hj = (p2*1).toFixed(2);
                }
                if(p2>10){
                    hj = (p1*1).toFixed(2);
                }
                $("#price"+id).val(hj);
            //   alert();
                for(var i=1;i<11;i++){
               
                    if($('#price'+i+'').val()){
                        
                        if($('#price'+i+'').val()>10){
                            zong1 = zong1;
                        }else{
                            zong1 = (zong1*1+ $('#price'+i+'').val()*1).toFixed(2);
                        }
                    }
                    
                    if($('#price'+i+'_1').val()){
                        
                        if($('#price'+i+'_1').val()>10){
                            zong2 = zong2;
                        }else{
                            zong2 = (zong2*1+$('#price'+i+'_1').val()*1).toFixed(2);
                        }
                    }
                    
                    if($('#price'+i+'_2').val()){
                        
                        if($('#price'+i+'_2').val()>10){
                            zong3 = zong3;
                        }else{
                            zong3 = (zong3*1+$('#price'+i+'_2').val()*1).toFixed(2);
                        }
                    }
                    
                }
                // // alert(zong1);
                $("#zong1").val(zong1);
                $("#zong2").val(zong2);
                $("#zong3").val(zong3);
                
            }
        $("#if_two").hide();
            layui.config({
                base: '/static/xadmin/js/' //此处路径请自行处理, 可以使用绝对路径
            }).extend({
                formSelects: 'formSelects-v4'
            });
            layui.use(['form', 'layer','jquery','upload','laydate','formSelects'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;
                 var upload = layui.upload;
                var laydate = layui.laydate;
                var formSelects = layui.formSelects;
                

          
                // layer('.upload').each(function () {
                    upload.render({
                      elem: "#1"
                      , url: '/index/index/uploadfield' //改成您自己的上传接口
                      , accept: 'file' //普通文件
                      , done: function (res) {
                          console.log(res.msg);
                        $("#field_1").val(res.msg);
                        layer.msg("上传成功");
                      }
                    });
                //   });
                  laydate.render({
                    elem: '#date',
                    trigger: 'click'
                  });
                  lay('.date').each(function () {
                    laydate.render({
                      elem: this, //元素
                    });
                  });
                form.on('switch(if_two)', function(data){
                    // console.log(this.checked);
                    if(this.checked){
                        var html='<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">\n' +
    '                      <legend>第二申请人</legend>\n' +
    '                    </fieldset>\n' +
    '                    <div class="layui-form-item">\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                                <span class="x-red">*</span>申请人姓名</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text" id="L_username" name="name2" value="" required="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                                <span class="x-red">*</span>性别</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <select name="sex2">\n' +
    '                                    <option value="">---请选择---</option>\n' +
    '                                    <option value="1" >男</option>\n' +
    '                                    <option value="0" >女</option>\n' +
    '                                </select>\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                            <span class="x-red">*</span>出生年月</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text" name="birthday2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input date">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                    </div>\n' +
    '\n' +
    '\n' +
    '                    <div class="layui-form-item">\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                            <span class="x-red">*</span>职务/职称</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text" name="zhiwu2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                                <span class="x-red">*</span>所在部门</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text" name="bumen2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                            <span class="x-red">*</span>是否专职教师</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <select name="if_teacher2">\n' +
    '                                    <option value=\'\'>---请选择---</option>\n' +
    '                                    <option value=\'1\' >是</option>\n' +
    '                                    <option value=\'0\'>否</option>\n' +
    '                                </select>\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                    </div>\n' +
    '                    \n' +
    '                    <div class="layui-form-item">\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                            <span class="x-red">*</span>最终学历</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text" name="xueli2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                                <span class="x-red">*</span>最后学位</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text"  name="xuewei2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                            <span class="x-red">*</span>外语语种及水平</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text"  name="waiyu2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                    </div>\n' +
    '                    \n' +
    '                    <div class="layui-form-item">\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                            <span class="x-red">*</span>专业领域</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text"  name="lingyu2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        <div class="layui-inline">\n' +
    '                            <label for="L_username" class="layui-form-label">\n' +
    '                                <span class="x-red">*</span>手机号</label>\n' +
    '                            <div class="layui-input-inline">\n' +
    '                                <input type="text" name="phone2" required="" value="" lay-verify="required" autocomplete="off" class="layui-input">\n' +
    '                            </div>\n' +
    '                        </div>\n' +
    '                        \n' +
    '                    </div>';
                        $("#if_two").html(html);
                        $("#if_two").show();
                        $("#two").val('1');
                    }else{
                         $("#if_two").html('');
                        $("#if_two").hide();
                        $("#two").val('0');
                    }
                    layui.use(['layer','form','laydate'],function () {
                        var laydate = layui.laydate;
	                    layui.form.render('select');
	                    laydate.render({
                            elem: '.date',
                            trigger: 'click'
                          });
		            });
                });
                //监听申请提交
                form.on('submit(add)',
                function(data) {

                    //发异步，把数据提交给php
                    $.ajax({
                        url:"/index/keti/shenbao",
                        type:"post",
                        data:$('.layui-form').serialize(),
                        dataType:"json",
                        success:function (res) {
                            if (res.status == 1){
                                layer.alert('提交成功', {
                                        icon: 6
                                    },
                                    function() {
                                       location.href = '/index/keti/shenqinglist';
                                    });
                            } else{
                                layer.alert(res.msg, {
                                    icon: 5
                                })
                            }

                        }
                    });

                    return false;
                });
                //保存提交
                form.on('submit(add1)',
                function(data) {
                    //发异步，把数据提交给php
                    $.ajax({
                        url:"/index/keti/shenbao?baocun=1",
                        type:"post",
                        data:$('.layui-form').serialize(),
                        dataType:"json",
                        success:function (res) {
                            if (res.status == 1){
                                layer.alert(res.msg, {
                                        icon: 6
                                    },
                                    function() {
                                       location.href = '/index/keti/shenqinglist';
                                    });
                            } else{
                                layer.alert(res.msg, {
                                    icon: 5
                                })
                            }

                        }
                    });

                    return false;
                });
            });
            function yanzheng(value,name){
                if(value==''){
                    layer.msg(name+'不能为空');
                    return false;
                }
                return true;
            }
            var k = 0;
            $("#html1").hide();
            function add_class(){
                $("#but1").hide();
                $("#html1").show();
                var html="<tr id='id1_"+k+"'>\n" +
                "                            <td><input name=\"cate_title["+k+"]\" lay-verify=\"required\" class=\"layui-input\" style=\"border:none;\" /></td>\n" +
                "                            <td><input name=\"class_title["+k+"]\" lay-verify=\"required\" class=\"layui-input\" style=\"border:none;\" /></td>\n" +
                "                            <td><input name=\"p_time["+k+"]\" lay-verify=\"required\"  class=\"layui-input\" style=\"border:none;\" /></td>\n" +
                "                            <td><input name=\"if_finish["+k+"]\" lay-verify=\"required\" class=\"layui-input\" style=\"border:none;\" /></td>\n" +
                "                            <td><a href=\"javascript:void(0);\"  onclick=\"add_class()\">增加</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:void(0);\" onclick=\"lot_class("+k+")\">删除</a></td>\n" +
                "                        </tr>";
                k++;
                $("#html1").append(html);
                $("#textid1").show();
                layui.use('laydate,form', function(){
                  var laydate = layui.laydate;
                  var form = layui.form;
                  //对每个laydate
                  lay('.date').each(function(){
                    laydate.render({
                      elem: this,
                      trigger: 'click'
                    });
                  });
                });
            }
            function lot_class(id){
                // alert(id);
                $("#id1_"+id).remove();
                k--;
                if(k==0){
                    $("#html1").hide();
                    $("#but1").show();
                    $("#textid1").hide();
                }
            }
            function lot_member(id){
                // alert(id);
                $("#id2_"+id).remove();
                // var html = $(".html2").html();
                
                n--;
                if(n==0){
                    $("#textid2").hide();
                    $("#but_2").show();
                    $("#html2").hide();
                }
            }
            $("#html2").hide();
            var n = 0;
            function add_member(){
                $("#but_2").hide();
                $("#html2").show();
                 var html ="<tr id='id2_"+n+"'>\n" +
            "                            <td><input type=\"text\" name=\"member_name["+n+"]\" required=\"\" value=\"\" lay-verify=\"required\" style=\"border:none;\" autocomplete=\"off\" class=\"layui-input\"></td>\n" +
            "                            <td><input type=\"text\"  name=\"member_zhiye["+n+"]\" required=\"\" value=\"\" lay-verify=\"required\" style=\"border:none;\" autocomplete=\"off\" class=\"layui-input\"></td>\n" +
            "                            <td><input type=\"text\"  name=\"member_year["+n+"]\" required=\"\" value=\"\" lay-verify=\"required\" style=\"border:none;\" autocomplete=\"off\" class=\"layui-input\"></td>\n" +
            "                            <td><input type=\"text\" name=\"member_zhuanye["+n+"]\" required=\"\" value=\"\" lay-verify=\"required\" style=\"border:none;\" autocomplete=\"off\" class=\"layui-input\"></td>\n" +
            "                            <td><input type=\"text\"  name=\"member_fengong["+n+"]\" required=\"\" value=\"\" lay-verify=\"required\" style=\"border:none;\" autocomplete=\"off\" class=\"layui-input\"></td>\n" +
            "                            <td><input type=\"text\"  name=\"member_danwei["+n+"]\" required=\"\" value=\"\" lay-verify=\"required\" style=\"border:none;\" autocomplete=\"off\" class=\"layui-input\"></td>\n" +
            "                            <td><a href=\"javascript:void(0);\"  onclick=\"add_member()\">增加</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:void(0);\" onclick=\"lot_member("+n+")\">删除</a></td>\n" +
            "                        </tr>";
                n++;
                $("#html2").append(html);
                $("#textid2").show();
                layui.use('form', function(){

                  var form = layui.form;

                });
            }
            function tj(){
                 $.ajax({
                        url:"/index/keti/shenbao?baocun=1",
                        type:"post",
                        data:$('#myform').serialize(),
                        dataType:"json",
                        success:function (res) {
                            if (res.status == 1){
                                layer.alert('保存成功', {
                                        icon: 6
                                    },
                                    function() {
                                       location.href = '/index/keti/shenqinglist';
                                    });
                            } else{
                                layer.alert(res.msg, {
                                    icon: 5
                                })
                            }

                        }
                    });
            }
        </script>

        <script>var _hmt = _hmt || []; (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
    </body>

{/block}
